@()(implicit request: RequestHeader)
@main("历史数据")("missionManage") {
	<style>
			.genome-pre {
				white-space: pre-wrap;
				word-wrap: break-word;
				border: 0px solid #ccc;
				background-color: white;
			}
	</style>
	<div class="page-content">

		<div class="page-bar">
			<ul class="page-breadcrumb">
				<li>
					<i class="fa fa fa-table"></i>
					<a href="">历史数据</a>
				</li>
			</ul>
		</div>


		<div class="row-fluid">
			<div class="row">
				<div class="col-md-12 col-sm-12">
					<div class="portlet green-jungle box">
						<div class="portlet-title">
							<div class="caption">
								历史数据
							</div>
						</div>

						<div class="portlet-body">
							<div class="table-responsive">

								<label>选择显示的列:</label>
								<div id="checkbox" class="checkbox">

								</div>

								<div id="toolbar">
									<button type="button" class="btn btn-primary" id="deleteButton" disabled="disabled"
									onclick="MissionManage.deleteAllInfos">
										<i class="glyphicon glyphicon-trash"></i>&nbsp;删除选中记录
									</button>
								</div>

								<table class="display table table-bordered" id="missionTable" data-pagination="true" data-search="true"
								data-toolbar="#toolbar" data-page-list="[10, 25, 50, 100, 200]" data-multiple-search="true">
									<thead>
										<tr>
											<th data-field="state" data-checkbox="true"></th>
											<th data-field="sampleId" data-sortable="true">样品号</th>
											<th data-field="name" data-sortable="true">姓名</th>
											<th data-field="age" data-sortable="true">年龄</th>

											<th data-field="bmi" data-sortable="true">BMI</th>
											<th data-field="fbg" data-sortable="true">FBG</th>
											<th data-field="ggt" data-sortable="true">GGT</th>
											<th data-field="hdlch" data-sortable="true">HDLch</th>
											<th data-field="tbil" data-sortable="true">TBil</th>
											<th data-field="albumin" data-sortable="true">ALB</th>
											<th data-field="ast" data-sortable="true">AST</th>
											<th data-field="plt" data-sortable="true">PLT</th>

											<th data-field="endTime" data-sortable="true">录入时间</th>

											<th data-field='unit' data-sortable='true'>送检单位</th>
											<th data-field='address' data-sortable='true'>地址</th>
											<th data-field='sex' data-sortable='true'>性别</th>
											<th data-field='office' data-sortable='true'>送检科室</th>
											<th data-field='doctor' data-sortable='true'>申请医生</th>
											<th data-field='number' data-sortable='true'>门诊/住院号</th>
											<th data-field='sampleTime' data-sortable='true'>采样时间</th>
											<th data-field='submitTime' data-sortable='true'>送检时间</th>
											<th data-field='sampleType' data-sortable='true'>样本类型</th>
											<th data-field='sampleStatus' data-sortable='true'>样本状态</th>
											<th data-field='title' data-sortable='true'>标题</th>
											<th data-field='reporter' data-sortable='true'>检验人</th>
											<th data-field='checker' data-sortable='true'>审核人</th>
											<th data-field='checkDate' data-sortable='true'>检验日期</th>
											<th data-field='reportDate' data-sortable='true'>报告日期</th>

											<th data-field="operate" data-formatter="operateFmt" data-searchable="false">操作</th>
										</tr>
									</thead>
								</table>

							</div>
						</div>
					</div>
				</div>
			</div>

			@user.predictResult()

		</div>

	</div>

	@user.myTool()

	<script>

			function cancel() {
				MissionManage.updateMission()
				PredictResult.showResult(missionJson.id)
			}

			$(function () {
				MissionManage.init

				var array = ["姓名", "送检单位", "地址", "性别", "送检科室", "申请医生", "门诊/住院号", "采样时间", "送检时间",
					"样本类型", "样本状态", "标题", "检验人", "审核人", "检验日期", "报告日期"]
				var values = ["name", "unit", "address", "sex", "office", "doctor", "number", "sampleTime", "submitTime",
					"sampleType", "sampleStatus", "title", "reporter", "checker", "checkDate", "reportDate"]
				var html = ""
				$.each(array, function (n, value) {
							html += "<label style='margin-right: 15px'>" +
									"<input type='checkbox' checked  value='" + values[n] + "' onclick=\"setColumns('" + values[n] + "')\">" + value +
									"</label>"
						}
				);
				$("#checkbox").append(html)

				var hiddenArray = ["name", "unit", "address", "sex", "office", "doctor", "number", "sampleTime", "submitTime",
					"sampleType", "sampleStatus", "title", "reporter", "checker", "reportDate"]
				$.each(hiddenArray, function (n, value) {
					$('#missionTable').bootstrapTable('hideColumn', value);
					$("input:checkbox[value='" + value + "']").attr("checked", false)
				})

			})

			function setColumns(value) {
				var element = $("input:checkbox[value=" + value + "]")
				if (element.is(":checked")) {
					$('#missionTable').bootstrapTable('showColumn', value);
				} else {
					$('#missionTable').bootstrapTable('hideColumn', value);
				}
			}

			function operateFmt(value, row, index) {
				var deleteStr = "<a title='删除' onclick=\"MissionManage.deleteMission('" + row.id + "')\" style='cursor: pointer;'><span><em class='fa fa-close'></em></span></a>"
				var resultStr = "<a title='查看结果' onclick=\"PredictResult.showResult('" + row.id + "')\" style='cursor: pointer;'><span><em class='fa fa-eye'></em></span></a>"
				var rs = [resultStr, deleteStr]
				return rs.join(" ")
			}



	</script>


}
